<?php 
include('./fun.php');
$conn=my_sql($cfg);
$re=adm_login();
if($re['err']=='ok'){
 $adm=$re['adm']; 
}else{
$re=user_login();//用户登录
if($re['err']!='ok'){no_login();}
$user=$re['user'];
}

$sql='select * from '.$cfg['e'].'view ';
$id=g('id');
if($id){$sql.=' where user_id="'.$id.'" ';}
$ss=g('ss');
if($ss){
$sql.=' where session="'.$ss.'" ';
}


$page=g('page');if(!$page){$page=1;}
$page_num=20;
$start=($page-1)*$page_num;
$sql.=' order by id desc limit '.$start.','.$page_num;
$l=db($sql);
//print_r($l);
?>
<style>
p{margin:0;padding:0}
</style>
<hh><b>浏览记录</b></hh>
<mm>
<?php 
if($l){$url=url_get(['page','ss','id']);
echo '<table>';
th(['logo','昵称','时间','session','数据']);
foreach($l as $v){
echo '<tr>';
echo '<td style="width:50px"><img src="'.$v['logo'].'" style="width:40px;height:40px;border-radius:50%;"></td>';

echo '<td><a href="?'.$url.'&id='.$v['user_id'].'">'.base64($v['nickname']).'</a></td>';
echo '<td>'.date('Y-m-d H:i:s',$v['date']).'</td>';

echo '<td><a  href="?'.$url.'&ss='.$v['session'].'">'.$v['session'].'</a></td>';
$data=unserialize(out($v['data']));

//print_r($data);
echo '<td>';
foreach($data as $t){
echo '<p>'.$t['ac'].' '.($v['date']-$t['time']).'秒前 '.$t['page'].'</p>';


}
echo '</td>';
echo '</tr>';
}
echo '</table>';
page();
}else{no_data();}


?>

</mm>


<script></script>